<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
cfc('core')->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$item=pdo_get('core_members',array('id'=>$_SESSION['uid']),array('username','nickname','isrealname','realname','mobile','realmobile','cardnum'));
	$item['nickname']=$item['nickname']?:$item['username'];
	$item['sn']=$_RQ['sn'];
	if($_RQ['sn'] && $_RQ['hy_token_id']){
		$pay_log=pdo_get('core_paylog',array('tid'=>trim($_RQ['sn']),'uniacid'=>$_SESSION['uniacid']));
		$this->model('pay')->upsms($pay_log,$_RQ['hy_token_id']);
	}
	$tips='请提交短信，确认支付！';
	$return['item']=$item;
	$return['tips']=$tips;
	$return['basic']=$this->plugin_setting('basic');
	set_html('title','短信确认支付');
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	if(!$postdata['sn']){
		exi('异常请求！','error');
	}
	if(!$postdata['verify_code']){
		exi('请输入验证码！','error');
	}
	$sms=pdo_get('jy_heepay_smslog',array('sn'=>$postdata['sn'],'uniacid'=>$_SESSION['uniacid'],"mid"=>$_SESSION['uid']));
	if(!$sms['hy_token_id']){
		exi('发送短信异常！','error');
	}
	$this->model('pay')->checkpay($sms,$postdata['verify_code']);
	$pay_log=pdo_get('core_paylog',array('tid'=>trim($postdata['sn']),'uniacid'=>$_SESSION['uniacid']));
	if($pay_log['success_url']){
		exi('','',$pay_log['success_url']);
	}
	exi('提交成功！');
}